<template>
  <div class="hm-son">
    <h2>子组件</h2>
    <div>爸爸的钱包: {{ money }}</div>
    <div>爸爸的车: {{ car }}</div>
    <div>爸爸的房: {{ house }}</div>
    <button @click="addMoney()">拼命搬砖1月</button>
    <button @click="changeCar()">换车</button>
  </div>
</template>

<script>


export default {
  name: 'HmSon',
  props: ['money', 'car', 'house'],
  methods: {
    addMoney() {
      // 发射自定义事件
      this.$emit('addMoney', this.money + 20000)
    },
    changeCar() {
      this.$emit('changeCar', '保时捷')
    }
  }
}
</script>

<style lang="less">
.hm-son {
  width: 400px;
  height: 200px;
  background-color: pink;
}
</style>
